<template>
    <div class="task-feature">
        <div class="task-feature-title">今日任务</div>
        <div class="task-feature-body bb bt">
            <div class="task-list">
                <!--<div class="task-item bb">
                    联络5个最近6个月未到访客<span class="task-status fr task-not-start">未完成</span>
                </div>
                <div class="task-item bb">
                    关怀5个高净值客户<span class="task-status fr task-doing">已完成21个</span>
                </div>
                <div class="task-item">
                    回访5个潜在保养客户<span class="task-status fr task-done">已完成</span>
                </div>-->
                <div class="task-item bb" v-for="task in listStoreTask" @click="href(task.taskId)">
                    {{task.taskName}}
                    <span class="task-status fr task-done" v-if="task.completedCount == task.targetCount">已完成</span>
                    <span class="task-status fr task-not-start" v-else-if="task.realCount == 0">未完成</span>
                    <span class="task-status fr task-doing" v-else>已完成{{task.realCount}}个</span>
                </div>
            </div>
        </div>
    </div>
</template>
<script type="text/ecmascript-6">
    export default{
        data(){
            return {
                storeId: 1700012,
                listStoreTask: {}
            };
        },
        created(){
            this.$http.get('/mobile/stroeTask/listStoreTask?storeId=' + this.storeId).then(function (res) {
                res = res.body;
                if(res.code == 0){
                    res = res.result;
                    this.listStoreTask = res;
                }else {
                    console.warn(res.code);
                }
            }, function (res) {
                console.warn('错误码'+ res.status);
            })
        },
        methods: {
            href(num){
                window.location.href = './clientList.html#' + num;
//                alert('跳转到第' + num + '个任务的列表页');
            }
        }
    }
</script>
<style lang="scss">
    @import "../../assets/css/common.scss";

    .task-feature{
        background-color: #fff;
        .task-feature-title{
            background-color: #faf6f5;
            line-height: rem(16);
            padding: rem(10) rem(12);
            font-size: rem(14);
            color: #a68f88;
        }
    }
    .task-feature-body{
        .task-list{
            padding-left: rem(12);
            .task-item{
                padding: rem(14) rem(12) rem(14) 0;
                font-size: rem(14);
                line-height: rem(16);
                .task-done, .task-doing{
                    color: #79cf19;
                }
                .task-not-start{
                    color: #cf9a19;
                }
            }
        }
    }
</style>
